package com.fyy.singleton;

/**
 * @Author fyy
 * @Description 懒汉模式，线程非安全
 * @Date 2020/7/17 10:49
 */
public class LazySingletonUnSYN {

    //创建一个私有的对象
    private static LazySingletonUnSYN singleBean = null;

    //构造方法私有化，使其不能被实例化
    private LazySingletonUnSYN (){

    }

    //获取唯一可用对象,需要时再实例化
    public static LazySingletonUnSYN getInstance(){
        if(null == singleBean){
            singleBean = new LazySingletonUnSYN();
        }
        return singleBean;
    }

    public void outMessages(){
        System.out.println("hello world");
    }

}
